##############################################################
## MOD Title: Google Earth Coppermine Flickr-like gallery MOD
## MOD Author: CAIO BORGHOFF <biofoto@caioborghoff.fot.br> http://www.portalimagemsub.fot.br
## MOD Description: This mod allow to display geo-referenced Coppermine Gallery pictures with Google
## Earth (like Flickr) trough user profile buttons and trough Coppermine menu
## MOD Version: 0.0.0
## MOD Compatibility: 2.0.17
## 
## Files To Edit: 7
##	         viewtopic.php
##	         includes/functions_validate.php
##	         includes/usercp_viewprofile.php
##	         language/lang_english/lang_main.php
##	         templates/subSilver/profile_view_body.tpl
##	         templates/subSilver/subSilver.cfg
##	         templates/subSilver/viewtopic_body.tpl
## Included Files: 3
##                      geofoto.php
##                      geofotouser.php
##                      img/icon_google.gif
############################################################## 
## Author Notes:
##  This MOD is based on the 'Orkut Profile MOD' [MN f NEMEI]
## < gustavo@acidnuts.com > (Gustavo Montes) http://www.phpbb.com.br and the
##  original Modification ' Blog in Viewtopic ' Lapinox (mail@lapinox.net) of phpbb-fr.com
##  and on original "Export to Google Earth KML" hack from dawidi posted on Atlas Mod forum
##  http://jonemo.de/atlasmod/forum/viewtopic.php?t=16
##
##  This MOD require Coppermine Gallery bridged with phpBB
##  http://coppermine-gallery.net/demo/cpg14x/docs/index.htm#integrating
##
##  The coordinates format must be decimal!!
##
##  This MOD still need modifications to allow user and admin to activate the Google Earth buttom from profile
##  administration panel, to hide buttons from users that do not have geo-referenced pictures on Coppermine
##  Galleries and to avoid pictures from private galleries to be displayed through Google Earth. By now, the admin
##  must activate the user Google buttom from phpMyAdmin. Any contributions will be extremely appreciated.
##
##############################################################
## MOD History: 
## 
## 01-14-2006 - Version 0.0.0
##  This MOD still need modifications to allow user and admin to activate the Google Earth buttom from profile
##  administration panel, to hide buttons from users that do not have geo-referenced pictures on Coppermine
##  Galleries and to avoid pictures from private galleries to be displayed through Google Earth. By now, the admin
##  must activate the user Google buttom from phpMyAdmin. Any contributions will be extremely appreciated.
##
############################################################## 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
############################################################## 


#------------Coppermine Gallery instructions-------------
# I used number 2 and 3 in a total of the 4 "Custom fields for image description" to respectively insert the Longitude
# and Latitude coordinates. These fields corresponds to "user2" and "user3" fields in the "cpg_pictures" database
# table. If you like to use other fields, change "user2" and "user3" throughout this mod and included files,
# accordingly. If you dot not have available custom fields, use the "More than 4 fields MOD"
# http://coppermine-gallery.net/forum/index.php?topic=7803.0
#


Go to Coppermine Gallery Config page and change "Custom fields for image description" 2 and 3 names to "Longitude" and "Latitude" respectively.

Change the "Custom menu link name" to "Google Earth" and the " Custom menu link URL" to http://www.yourdomain.com/forum/geofoto.php?.kml  this url will download a kml file that can be opened with Google Earth, displaying all pictures from your Coppermine Gallery that have coordinates different then "0".


#
#-----[ SQL ]------------------------------------------------
# change the cpg_pictures table prefix to match your table and user fields to match your custom fields

ALTER TABLE `cpg_pictures` CHANGE `user2` `user2` FLOAT NOT NULL DEFAULT '0'
ALTER TABLE `cpg_pictures` CHANGE `user3` `user3` FLOAT NOT NULL DEFAULT '0'

ALTER TABLE `phpbb_users` ADD `user_display_google` TINYINT( 1 ) DEFAULT NULL ;


#
#-----[ COPY ]------------------------------------------------
#

copy img/icon_google.gif to templates/subSilver/images/lang_english/icon_google.gif
copy root/geofoto.php to root/geofoto.php
copy root/geofotouser.php to root/geofotouser.php

#
#-----[ OPEN ]------------------------------------------------
#

viewtopic.php

#
#-----[ FIND ]------------------------------------------------
#
# the lines are too longer

$sql = "SELECT u.username, u.user_id,

#
#-----[ IN-LINE FIND ]---------------------------------------- 
#

, u.user_from

#
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
#

, u.user_display_google

#
#-----[ FIND ]------------------------------------------------
#

$msn = ( $postrow[$i]['user_msnm'] ) ? '<a href="' . $temp_url . '">' . $lang['MSNM'] . '</a>' : '';

#
#-----[ AFTER, ADD ]------------------------------------------
# change the domain and forum path accordingly

        $displaygoogle_img = ( $postrow[$i]['user_display_google'] ) ? '<a href="http://www.yourdomain.com/forum/geofotouser.php?u=' . $postrow[$i]['user_id'] . '&amp;.kml" target="_userwww"><img src="' . $images['icon_google'] . '" alt="' . $lang['GOOGLE'] . ': ' . $postrow[$i]['username'] . '" title="' . $lang['GOOGLE'] . ': ' . $postrow[$i]['username'] . '" border="0" /></a>' : '';
		$displaygoogle = ( $postrow[$i]['user_display_google'] ) ? '<a href="http://www.yourdomain.com/forum/geofotouser.php?u=' . $postrow[$i]['user_id'] . '&amp;.kml" target="_userwww">' . $lang['GOOGLE'] . '</a>' : '';



#
#-----[ FIND ]------------------------------------------------
#

$msn_img = '';
$msn = '';

#
#-----[ BEFORE, ADD ]------------------------------------------
#

		$displaygoogle_img = '';
		$displaygoogle = '';

#
#-----[ FIND ]------------------------------------------------
#

		'MSN_IMG' => $msn_img,
		'MSN' => $msn,

#
#-----[ BEFORE, ADD ]------------------------------------------
#

		'GOOGLE_IMG' => $displaygoogle_img,
		'GOOGLE' => $displaygoogle,
		

#
#-----[ OPEN ]------------------------------------------------
#

templates/subSilver/viewtopic_body.tpl

#
#-----[ FIND ]------------------------------------------------
#
# the lines are too longer

<td valign="middle" nowrap="nowrap">{postrow.PROFILE_IMG} {postrow.PM_IMG} {postrow.EMAIL_IMG}

#
#-----[ IN-LINE FIND ]----------------------------------------
#

{postrow.MSN_IMG}

#
#-----[ IN-LINE AFTER, ADD ]----------------------------------
#

 {postrow.GOOGLE_IMG}
 



#
#-----[ OPEN ]------------------------------------------------
#

templates/subSilver/subSilver.cfg

#
#-----[ FIND ]------------------------------------------------
#

$images['icon_msnm'] = "$current_template_images/{LANG}/icon_msnm.gif";

#
#-----[ AFTER, ADD ]-----------------------------------------
#

$images['icon_google'] = "$current_template_images/{LANG}/icon_google.gif";

 


#
#-----[ OPEN ]------------------------------------------------
#

language/lang_english/lang_main.php

#
#-----[ FIND ]------------------------------------------------
#

$lang['YIM'] = 'Yahoo Messenger';

#
#-----[ AFTER, ADD ]-----------------------------------------
#

$lang['GOOGLE'] = 'Google Earth Gallery';
$lang['Visit_google'] = 'Visit member\'s Google Earth Gallery';


#
#-----[ OPEN ]------------------------------------------------
#

templates/subSilver/profile_view_body.tpl

#
#-----[ FIND ]------------------------------------------------
#

<tr>
  <td valign="middle" nowrap="nowrap" align="right"><span class="gen">{L_MESSENGER}:</span></td>
  <td class="row1" valign="middle"><span class="gen">{MSN}</span></td>
</tr>

#
#-----[ AFTER, ADD ]-----------------------------------------
#

		<tr>
		  <td valign="middle" nowrap="nowrap" align="right"><span class="gen">{L_GOOGLE}:</span></td>
		  <td class="row1" valign="middle"><span class="gen">{GOOGLE_IMG}</span></td>
		</tr>
 
 
#
#-----[ OPEN ]------------------------------------------------
#

includes/usercp_viewprofile.php

#
#-----[ FIND ]------------------------------------------------
#

$yim_img = ( $profiledata['user_yim'] ) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $profiledata['user_yim'] . '&amp;.src=pg"><img src="' . $images['icon_yim'] . '" alt="' . $lang['YIM'] . '" title="' . $lang['YIM'] . '" border="0" /></a>' : '';
$yim = ( $profiledata['user_yim'] ) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $profiledata['user_yim'] . '&amp;.src=pg">' . $lang['YIM'] . '</a>' : '';

#
#-----[ AFTER, ADD ]-----------------------------------------
#

$displaygoogle_img = ( $profiledata['user_display_google'] ) ? '<a href="http://www.yourdomain.com/forum/geofotouser.php?u=' . $profiledata['user_id'] . '&amp;.kml" target="_userwww"><img src="' . $images['icon_google'] . '" alt="' . $lang['GOOGLE'] . ': ' . $profiledata['username'] . '" title="' . $lang['GOOGLE'] . ': ' . $profiledata['username'] . '" border="0" /></a>' : '';
$displaygoogle = ( $profiledata['user_display_google'] ) ? '<a href="http://www.yourdomain.com/forum/geofotouser.php?u=' . $profiledata['user_id'] . '&amp;.kml" target="_userwww">' . $lang['GOOGLE'] . '</a>' : '';


#
#-----[ FIND ]------------------------------------------------
#

'YIM' => $yim,

#
#-----[ AFTER, ADD ]-----------------------------------------
#

	'GOOGLE_IMG' => $displaygoogle_img,
	'GOOGLE' => $displaygoogle,

#
#-----[ FIND ]------------------------------------------------
#

'L_YAHOO' => $lang['YIM'],

#
#-----[ AFTER, ADD ]-----------------------------------------
#

	'L_GOOGLE' => $lang['GOOGLE'],
	'L_VISIT_GOOGLE' => $lang['Visit_google'],


#
#-----[ OPEN ]------------------------------------------------
#

includes/functions_validate.php

#
#-----[ FIND ]------------------------------------------------
#
# the lines are too longer

function validate_optional_fields(&$icq, &$aim, &$msnm, &$yim,

#
#-----[ IN-LINE FIND ]----------------------------------------
#

, &$sig

#
#-----[ IN-LINE AFTER, ADD ]----------------------------------
#

, &$displaygoogle

#
#-----[ FIND ]------------------------------------------------
#
# the lines are too longer

$check_var_length = array('aim', 'msnm', 'yim',

#
#-----[ IN-LINE FIND ]----------------------------------------
#

, 'sig'

#
#-----[ IN-LINE AFTER, ADD ]----------------------------------
#

, 'display_google'


#
#-----[ OPEN ]------------------------------------------------
#

geofoto.php


#
#-----[ FIND AND REPLACE ]------------------------------------------------
# replace with your Coppermine table prfix

cpg_pictures

#
#-----[ FIND AND REPLACE ]------------------------------------------------
#
#replace with coordinates of your contry

    <longitude>-32</longitude>
    <latitude>-4</latitude>
    
#
#-----[ FIND AND REPLACE ]------------------------------------------------
# replace with a path to a icon image to be displayed as placemark icon

        <href>http://www.yourdomain.com/images/icon.gif</href>
        
        
#
#-----[ FIND AND REPLACE ]------------------------------------------------
# replace with your Coppermine path - there are a few places to replace

www.yourdomain.com/coppermine


See additional text to be replaced when you open the file with Google Earth

#
#-----[ OPEN ]------------------------------------------------
#

geofotouser.php


#
#-----[ FIND AND REPLACE ]------------------------------------------------
# replace with your Coppermine table prfix

cpg_pictures

#
#-----[ FIND AND REPLACE ]------------------------------------------------
#
#replace with coordinates of your contry

    <longitude>-32</longitude>
    <latitude>-4</latitude>

#
#-----[ FIND AND REPLACE ]------------------------------------------------
# replace with a path to a icon image to be displayed as placemark icon

        <href>http://www.yourdomain.com/images/icon.gif</href>


#
#-----[ FIND AND REPLACE ]------------------------------------------------
# replace with your Coppermine path - there are a few places to replace

www.yourdomain.com/coppermine


See additional text to be replaced when you open the file with Google Earth


##---------Buttom Activation--------------

Go to phpMyAdmin and change field "user_display_google" to "1" for users you would like to display the Google Earth buttom. Only pictures with coordinates will be displayed through Google Earth!!!!

# 
#-----[ SAVE/CLOSE ALL FILES ]-------------------------------- 
# 
# EoM
